//
//  LSRegistViewController.m
//  KuaiYi
//
//  Created by 董立权 on 2016/11/13.
//  Copyright © 2016年 HeiMa. All rights reserved.
//

#import "LSRegistViewController.h"
#import <Masonry.h>
#import "HMAdditions.h"
@interface LSRegistViewController ()
    @property (nonatomic,weak) UITextField *phoneText;


@end

@implementation LSRegistViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

#pragma mark - 设置界面
-(void)setupUI{
    [super setupUI];
    //设置背景图片
    UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pic_hd"]];
    [self.view addSubview:iv];
    [iv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    
    
    //设置布局范围
    
    UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectZero];
    imgView.backgroundColor = [UIColor redColor];
    [self.view addSubview:imgView];
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake([UIScreen mainScreen].bounds.size.width, 300));
    }];
    
    //边距
    CGFloat margin = 30;
    //界面布局
    //电话
    UITextField *phoneField = [[UITextField alloc] initWithFrame:CGRectZero];
    phoneField.backgroundColor =[UIColor whiteColor];
    phoneField.keyboardType = UIKeyboardTypePhonePad;
    phoneField.leftView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"product_img_icon_xieyi.png"]];
    phoneField.leftViewMode = UITextFieldViewModeAlways;
    phoneField.layer.cornerRadius = 5;
    [imgView addSubview:phoneField];
    [phoneField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(imgView).offset(30);
        make.top.equalTo(imgView);
        make.right.equalTo(imgView).offset(-margin);
        make.height.mas_equalTo(margin);
    }];
    self.phoneText = phoneField;
    
    //验证按钮
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setTitle:@" 获取验证码 " forState:UIControlStateNormal];
    btn.backgroundColor = [UIColor hm_colorWithHex:0x20c6c6];
    btn.layer.cornerRadius = 15;
    [imgView addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(imgView).offset(-margin);
        make.top.equalTo(phoneField.mas_bottom).offset(margin);
    }];
    
    //验证码
    UITextField *codeFiled = [[UITextField alloc] initWithFrame:CGRectZero];
    codeFiled.backgroundColor = [UIColor whiteColor];
    codeFiled.keyboardType = UIKeyboardTypePhonePad;
    codeFiled.leftView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"product_img_icon_xieyi.png"]];
    codeFiled.leftViewMode = UITextFieldViewModeAlways;
    codeFiled.layer.cornerRadius = 5;
    [self.view addSubview:codeFiled];
    [codeFiled mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(phoneField.mas_bottom).offset(margin);
        make.left.equalTo(self.view).offset(margin);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(margin);
        
    }];
    
    //密码
    UITextField *passwordField = [[UITextField alloc] initWithFrame:CGRectZero];
    passwordField.backgroundColor = [UIColor whiteColor];
    passwordField.keyboardType = UIKeyboardTypePhonePad;
    passwordField.leftView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"product_img_icon_xieyi.png"]];
    passwordField.leftViewMode = UITextFieldViewModeAlways;
    passwordField.layer.cornerRadius = 5;
    [self.view addSubview:passwordField];
    [passwordField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(codeFiled.mas_bottom).offset(margin);
        make.left.equalTo(self.view).offset(margin);
        make.right.equalTo(self.view).offset(-margin);
        make.height.mas_equalTo(margin);
    }];
    
    //协议
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
